package com.config;

import org.n3r.idworker.Test;

/**
 * Created with IntelliJ IDEA.
 * User: HL
 * Date: 2020/5/7
 * Time: 11:49
 * Description: No Description
 */
public class Test1 {
    private static int count = 1;
    public static void main(String[] args){
        Test1 test = new Test1();
        String str = "abc";
        test.testString(str);

        A aA = test.new A(10,"456");
        aA.printValues();
        test.testRef(aA);
        aA.printValues();
        aA.a = 50;
        test.testRef(aA).printValues();
        aA.printValues();
    }
    public void testString(String str){
        String aStr = "abc";
        String bStr = "ab"+'c';
        String cStr = new String("abc");
        System.out.println((count++)+":"+(aStr.equals(cStr)) +" " +(aStr == cStr));
        System.out.println((count++)+":"+(aStr.equals(bStr)) +" " +(aStr == bStr));
    }
    public A testRef(A aRef){
        aRef.printValues();
        aRef.str ="ddd";
        aRef =new A(20,"987");
        aRef.printValues();
        return aRef;
    }
    class A{
        private int a = 5;
        private String str = "123";
        public A(int num,String str){
            a= num;
            this.str = str;
        }
        private  void  printValues(){
            System.out.println((count++) + ":a"+a+",str="+str);
        }
    }
}

